﻿<%@ WebHandler Language="C#" Class="list" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Web.Script.Serialization;
using System.Web.SessionState;
using System.Web.Services;

public class list : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
    private StringBuilder sb = null;
    public DataSet ds = null;
    public DataTable dt = null;
    private string sqlwhere = "";
    public void ProcessRequest (HttpContext context) {
        string type = PageBase.ext_string(context.Request.Params["type"]);

        switch (type)
        {
            //查询部位下拉选项
            case "getjd":
                get_jd(context);
                break;

            default:
                //getinfo(context);
                break;
        }
    }



    //查询进度
    public void get_jd(HttpContext context)
    {
        string OrderNo = PageBase.ext_string(context.Request.Params["OrderNo"]);
        long timeStamp =Utility.DateToTicks(DateTime.Now);
        string _sign = Utility.SignHelper.GetSign(Utility.ClientCode + "&" + Utility.keys + "&" + timeStamp);

        StringBuilder str = new StringBuilder();
        str.Append("{\"ClientCode\":\"" + Utility.ClientCode + "\",");
        str.Append("\"Timestamp\":\"" + timeStamp + "\",");
        str.Append("\"Sign\":\"" + _sign + "\",");
        str.Append("\"Data\":");
        str.Append("{\"OrderNo\":\"" + OrderNo + "\"}");
        str.Append("}");
        string serJson = str.ToString();
        string responseString =Utility.postrequest(Utility.siteHost, serJson);

         //字符串解析
        //JsonObject value = JsonObject.Parse(responseString);
        //string Status=value["Status"].ToString();
        //string IsSuccess = value["IsSuccess"].ToString();
        //if (Status == "200")
        //{
        //    if (IsSuccess == "true")
        //    {
        //            string OrderNo1 =value["Data"][0]["OrderNo"].ToString();
        //            string ProgressNo =value["Data"][0]["ProgressDetails"][0]["ProgressNo"].ToString();
        //    }

        //}
        //实体类解析
        //JavaScriptSerializer js = new JavaScriptSerializer();   //实例化一个能够序列化数据的类
        //Measurement_Order list = js.Deserialize<Measurement_Order>(responseString);    //将json数据转化为对象类型并赋值给list

        context.Response.Write(responseString.ToString());
        context.Response.ContentType = "text/json";
        context.Response.End();
    }
    

    public class ProgressMain
    {
        //订单号
        public string orderno;
        public string ORDERNO
        {
            get { return orderno; }
            set { orderno = value; }
        }
        //夏梦SAP号
        public string sapno;
        public string SapNo
        {
            get { return sapno; }
            set { sapno = value; }
        }
        //成衣物料号
        public string prodcode;
        public string PRODCODE
        {
            get { return prodcode; }
            set { prodcode = value; }
        }
        //数量
        public int qty;
        public int Qty
        {
            get { return qty; }
            set { qty = value; }
        }
        //订单状态
        public string orderstatus;
        public string OrderStatus
        {
            get { return orderstatus; }
            set { orderstatus = value; }
        }
        public List<ProgressDetails> ProgressDetails { get; set; }

    }
    public class ProgressDetails
    {
        //生产进度编号
        public string progressno;
        public string PROGRESSNO
        {
            get { return progressno; }
            set { progressno = value; }
        }
        //款式编码
        public string modelcode;
        public string MODELCODE
        {
            get { return modelcode; }
            set { modelcode = value; }
        }
        //订单品类
        public string category;
        public string CATEGORY
        {
            get { return category; }
            set { category = value; }
        }
        //生产进度
        public string progressstatus;
        public string PROGRESSSTATUS
        {
            get { return progressstatus; }
            set { progressstatus = value; }
        }
        //完工时间
        public string progresstime;
        public string PROGRESSTIME
        {
            get { return progresstime; }
            set { progresstime = value; }
        }
    }

    public class GetDate
    {
        public List<typemanager> LoadData_type { get; set; }//总经理批示
    }
    public class typemanager
    {
        //id
        public string id;
        public string ID
        {
            get { return id; }
            set { id = value; }
        }
        //部位
        public string bwothername;
        public string BWOTHERNAME
        {
            get { return bwothername; }
            set { bwothername = value; }
        }
        public string sel_bw;
        public string SEL_BW
        {
            get { return sel_bw; }
            set { sel_bw = value; }
        }
        public string sel_cm;
        public string SEL_CM
        {
            get { return sel_cm; }
            set { sel_cm = value; }
        }

        public string cmwm;
        public string CMWM
        {
            get { return cmwm; }
            set { cmwm = value; }
        }
        public string cmnm;
        public string CMNM
        {
            get { return cmnm; }
            set { cmnm = value; }
        }
        public string bwvalue;
        public string BWVALUE
        {
            get { return bwvalue; }
            set { bwvalue = value; }
        }

        public string isactive;
        public string ISACTIVE
        {
            get { return isactive; }
            set { isactive = value; }
        }
    }


    public bool IsReusable {
        get {
            return false;
        }
    }

}